package com.hp.bon.sgw.bean;

import org.dom4j.Document;
import org.dom4j.Element;

import com.hp.bon.sgw.util.Comutils;

public class XmlMessage {

	public XmlMessage(boolean isRequest) {
		this.isRequest = isRequest;
	}

	public boolean isRequest;
	private String mid;
	private String scid;
	private String uid;
	private String pwd;
	private String sig;
	private int reptag;
	private String rsv1;
	private String rsv2;
	private String data;
	public int length;
	private String ip;
	private String rtt;
	private String rc;
	private String ds;
	private Element dataElement;

	private long msgTime;

	public String getMID() {
		return mid;
	}

	public String getSCID() {
		return scid;
	}

	public String getUID() {
		return uid;
	}

	public String getPWD() {
		return pwd;
	}

	public String getSIG() {
		return sig;
	}

	public int getREPTAG() {
		return reptag;
	}

	public String getRSV1() {
		return rsv1;
	}

	public String getRSV2() {
		return rsv2;
	}

	public String getDATA() {
		if (data == null && dataElement != null) {
			data = dataElement.asXML();
		}
		return data;
	}

	public int getLength() {
		return length;
	}

	public String getIp() {
		return ip;
	}

	public Element getDataElement() {
		return dataElement;
	}

	public String getRTT() {
		return rtt;
	}

	public String getRC() {
		return rc;
	}

	public String getDS() {
		return ds;
	}

	public void setMID(String mid) {
		this.mid = mid;
	}

	public void setSCID(String scid) {
		this.scid = scid;
	}

	public void setUID(String uid) {
		this.uid = uid;
	}

	public void setPWD(String pwd) {
		this.pwd = pwd;
	}

	public void setSIG(String sig) {
		this.sig = sig;
	}

	public void setREPTAG(int reptag) {
		this.reptag = reptag;
	}

	public void setRSV1(String rsv1) {
		this.rsv1 = rsv1;
	}

	public void setRSV2(String rsv2) {
		this.rsv2 = rsv2;
	}

	public void setDATA(String data) {
		this.data = data;
//		if (data != null && !"".equals(data) && dataElement == null) {
//			try {
//				Document doc = Comutils.parseText(data);
//				this.dataElement = doc.getRootElement();
//			} catch (Exception e) {// TODO Auto-generated catch block
//			
//			}
//		}
	}

	public void setLength(int length) {
		this.length = length;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public void setDataElement(Element dataElement) {
		this.dataElement = dataElement;
	}

	public void setRTT(String rtt) {
		this.rtt = rtt;
	}

	public void setRC(String rc) {
		this.rc = rc;
	}

	public void setDS(String ds) {
		this.ds = ds;
	}

	public long getMsgTime() {
		return msgTime;
	}

	public void setMsgTime(long msgTime) {
		this.msgTime = msgTime;
	}

}
